import java.util.*;
//class Student implements Comparable{
//    public String name;
//    public int score;
//
//    @Override
//    public int compareTo(Object o) {
//        return 0;
//    }
//}
public class Main556 {

    public String name="abc";
    public int carFleet(int target, int[] position, int[] speed) {
        int length=position.length;
        Car car[]=new Car[length];
        for(int i=0;i<length;i++){
            car[i]=new Car(position[i],(double)(target-position[i])/speed[i]);
        }
        Arrays.sort(car, (a, b) -> Integer.compare(a.position, b.position));
        int count=0,i=length;
        while(--i>0){
            if(car[i].time<car[i-1].time){
                count++;
            }
            else{
                car[i-1]=car[i];
            }
        }
        return count+(i==0?1:0);
    }
    class Car{
        int position;
        double time;
        Car(int p,double t){
            position=p;
            time=t;
        }
    }
    public void sortColors(int[] nums) {
        for(int i=0;i<nums.length;i++){
            int temp=nums[i];
            int j=i-1;
            for(;j>=0;j--){
                if(temp<nums[j]){
                    nums[j+1]=nums[j];
                }
                else{break;}
            }
            nums[j+1]=temp;
        }
    }
    public static int compareVersion(String version1, String version2) {
        String[] ch1=version1.split("\\.");
        String[] ch2=version2.split("\\.");
        for(int i=0;i< ch1.length||i<ch2.length;i++){
            int x=0;
            int y=0;
            if (i< ch1.length){
                x=Integer.parseInt(ch1[i]);
            }
            if(i< ch2.length){
                y=Integer.parseInt(ch2[i]);
            }
            if (x<y){
                return -1;
            }
            if(x>y){
                return 1;
            }
        }
        return 0;
    }
    public static List<Integer> findClosestElements(int[] arr, int k, int x) {
        PriorityQueue<Integer> queue=new PriorityQueue<>();
        List<Integer> list=new ArrayList<>();
        if(k>arr.length){
            for (int num:arr) {
                list.add(num);
            }
        }
        else {
            for (int i = 0; i < arr.length; i++) {
                if(i<k){
                    queue.offer(arr[i]);
                }
                else {
                    int sum1=Math.abs(arr[i]-x);
                    int sum2=Math.abs(queue.peek()-x);
                    if(sum1<sum2){
                        queue.poll();
                        queue.offer(arr[i]);
                    }
                }
            }
            while (!queue.isEmpty()){
                list.add(queue.poll());
            }
        }
        return list;
    }
    public static void main2(String[] args) {
        Main556 test=new Main556();
        Main556 testB=new Main556();
        System.out.println(test.equals(testB)+","+test.name.equals(testB.name));
    }
    public static void main(String[] args) {
        String versin1="01";
        String version2="1";
        int i=compareVersion(versin1,version2);
        System.out.println(i);
    }
}
